﻿using System.ComponentModel.Composition;
using System.Globalization;
using System.Resources;
using System.Windows.Media;
using OPSYS_Schematic.UIInfrastructure;

namespace OPSYS_Schematic.Presentation.Resources
{
    [Export(typeof (IResource))]
    public class Resource : IResource
    {
        private readonly ResourceManager imageSource;
        private readonly ResourceManager stringResource;
        private CultureInfo culture = new CultureInfo("zh-cn");

        public Resource()
        {
            stringResource = new ResourceManager("OPSYS_Schematic.Presentation.Resources.StringResource",
                                                 typeof (Resource).Assembly);
            imageSource = new ResourceManager("OPSYS_Schematic.Presentation.Resources.ImageResource",
                                              typeof (Resource).Assembly);
        }

        #region IResource Members

        public CultureInfo CurrentCulture
        {
            set { culture = value; }
        }

        public string GetString(string name)
        {
            return stringResource.GetString(name, culture);
        }

        public ImageSource GetImage(string name)
        {
            return imageSource.GetImageSource(name);
        }

        #endregion
    }
}